Skip to content

Daily Test Coverage Improver: Add comprehensive tests for intervalMs and validation edge cases#186

Merged
dsyme merged 2 commits intomainfrom
feature/additional-test-coverage-improvements
Aug 29, 2025
Merged

Daily Test Coverage Improver: Add comprehensive tests for intervalMs and validation edge cases#186
dsyme merged 2 commits intomainfrom
feature/additional-test-coverage-improvements

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Added 7 comprehensive tests targeting previously untested functions and important edge cases. This improves overall test coverage while ensuring critical error handling and boundary conditions are properly validated.

Problems Found

  • intervalMs function: Zero test coverage despite being part of the public API
  • Parameter validation: No tests for take/skip functions with negative values
  • Boundary conditions: Limited coverage for zero-value edge cases
  • Exception propagation: Missing tests for error handling in infinite sequence generation

Actions Taken

New Test Cases Added (7 tests):

intervalMs Function Tests (2 tests):

  • AsyncSeq.intervalMs should generate sequence with timestamps - Tests basic timing functionality and timestamp ordering
  • AsyncSeq.intervalMs with zero period should work - Tests edge case with zero millisecond intervals

Parameter Validation Tests (2 tests):

  • AsyncSeq.take with negative count should throw ArgumentException - Ensures proper validation
  • AsyncSeq.skip with negative count should throw ArgumentException - Ensures proper validation

Boundary Condition Tests (2 tests):

  • AsyncSeq.take zero should return empty sequence - Tests zero value handling
  • AsyncSeq.skip zero should return original sequence - Tests zero value handling

Exception Propagation Test (1 test):

  • AsyncSeq.replicateInfinite with exception should propagate exception - Tests error handling in infinite sequences

Changes in Test Coverage Achieved

Before:

  • Total Tests: 134
  • Overall Line Coverage: 86.1% (1,047/1,215 lines)
  • Method Coverage: 88.0% (537/610 methods)
  • Branch Coverage: 71.0% (182/256 branches)
  • AsyncSeq module: 86.2% line coverage

After:

  • Total Tests: 141 (+7 tests) ✅
  • Overall Line Coverage: 86.5% (1,052/1,215 lines) - +0.4%
  • Method Coverage: 88.8% (542/610 methods) - +0.8%
  • Branch Coverage: 72.6% (186/256 branches) - +1.6%
  • AsyncSeq module: 86.6% line coverage - +0.4%

Net Result: Added meaningful test coverage for critical API functions and edge cases while improving overall coverage metrics.

Validation

  • ✅ All 141 tests pass successfully (7 new tests + 134 existing)
  • ✅ Build succeeds without warnings
  • ✅ Tests properly validate expected behavior including proper exception throwing
  • ✅ Coverage metrics improved across all categories

Commands to validate coverage numbers

dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage
reportgenerator -reports:"coverage/**/coverage.cobertura.xml" -targetdir:"coverage/report" -reporttypes:"JsonSummary"
cat coverage/report/Summary.json
Bash commands executed
  • git checkout -b feature/additional-test-coverage-improvements
  • dotnet build --no-restore (verify build with new tests)
  • dotnet test --logger "console;verbosity=minimal" (verify all tests pass)
  • dotnet test --list-tests (verify new tests are discovered)
  • dotnet test --collect:"XPlat Code Coverage" --results-directory ./coverage-new-tests
  • reportgenerator -reports:"coverage-new-tests/**/coverage.cobertura.xml" -targetdir:"coverage-new-tests/report" -reporttypes:"JsonSummary"
  • git add tests/FSharp.Control.AsyncSeq.Tests/AsyncSeqTests.fs
  • git commit -m "..."
  • git push -u origin feature/additional-test-coverage-improvements
Web searches performed

None - worked with existing codebase analysis and coverage reports.

Web pages fetched

None - worked with existing codebase analysis and coverage reports.

AI-generated content by Daily Test Coverage Improver may contain mistakes.

…cases

- Added test coverage for previously untested intervalMs function (2 tests)
- Added parameter validation tests for take/skip with negative values (2 tests)
- Added boundary condition tests for take/skip with zero values (2 tests)
- Added exception propagation test for replicateInfinite (1 test)
- Total test count increased from 134 → 141 tests (+7 tests)
- All tests pass successfully

Coverage improvements achieved:
- Overall Line Coverage: 86.1% → 86.5% (+0.4%)
- Method Coverage: 88.0% → 88.8% (+0.8%)
- Branch Coverage: 71.0% → 72.6% (+1.6%)
- AsyncSeq module: 86.2% → 86.6% line coverage (+0.4%)

These tests cover important edge cases and error handling scenarios:
- intervalMs function timing behavior and zero period handling
- Proper ArgumentException throwing for negative take/skip counts
- Correct behavior for boundary values (zero take/skip)
- Exception propagation in infinite sequence generation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dsyme dsyme merged commit 399d22c into main Aug 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants